package com.example.app.pages.main.home.addNew

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.graphics.Color
import com.example.app.barStateViewModel
import com.example.app.components.MyScaffold.MyScaffoldHasTipAndLoading
import com.example.app.pages.main.home.accountList.viewModel.AccountListViewModel
import com.example.app.pages.main.home.addNew.addRecord.AddRecord
import com.example.app.pages.main.home.addNew.addRecord.viewModel.AddRecordViewModel
import com.example.app.pages.main.home.me.viewModel.AddNewViewModel
import com.example.app.routeViewModel
import com.example.app.viewmodel.AddNewChild
import com.example.app.viewmodel.BarStateViewModel
import com.example.app.viewmodel.MainViewModel
import com.example.app.viewmodel.RouteViewModel
import kotlinx.coroutines.CoroutineScope

@Composable
fun AddNew(

) {
    var curAddNewChild = routeViewModel.curAddNewChild.collectAsState()




    //路由
    MyScaffoldHasTipAndLoading() {
        when (curAddNewChild.value) {
            AddNewChild.ADD_RECORD -> {
                barStateViewModel.updateAll(
                    isShowBottomBar = false,
                    isStatusBarDarkIcon = false,
                    statusBarColor = Color.Transparent,
                    navigationBarColor = MaterialTheme.colorScheme.onPrimary,
                    isNavigationBarDarkIcon = true
                )
                AddRecord()
            }

            else -> {
                barStateViewModel.updateAll(
                    isShowBottomBar = true,
                    isStatusBarDarkIcon = true,
                    statusBarColor = MaterialTheme.colorScheme.background,
                    navigationBarColor = MaterialTheme.colorScheme.onPrimary,
                    isNavigationBarDarkIcon = true
                )
                AddNewBtns(
                    paddingValues = it,
                    routeViewModel = routeViewModel
                )
            }
        }
    }
}


